//
// Created by lihengliu on 2023/2/26.
//

#include "jni_double_util.h"
jclass JNIDoubleUtil::createDoubleClass(JNIEnv *env) {
    return env->FindClass("java/lang/Double");
}

jobject JNIDoubleUtil::createDoubleInstanceOfDouble(JNIEnv *env) {
    jclass class_double = createDoubleClass(env);
    jmethodID init_double = env->GetMethodID(class_double, "<init>", "(D)V");
    jobject obj_double = env->NewObject(class_double, init_double);
    return obj_double;
}

jobject JNIDoubleUtil::createDoubleInstanceOfDouble(JNIEnv *env, jclass class_double) {
    jmethodID init_double = env->GetMethodID(class_double, "<init>", "(D)V");
    jobject obj_double = env->NewObject(class_double, init_double);
    return obj_double;
}

jmethodID JNIDoubleUtil::createDoubleConstructorOfDouble(JNIEnv *env) {
    jclass class_double = createDoubleClass(env);
    jmethodID init_double = env->GetMethodID(class_double, "<init>", "(D)V");
    return init_double;
}

jmethodID JNIDoubleUtil::createDoubleConstructorOfDouble(JNIEnv *env,jclass class_double) {
    jmethodID init_double = env->GetMethodID(class_double, "<init>", "(D)V");
    return init_double;
}

jmethodID JNIDoubleUtil::createDoubleDoubleValueMethod(JNIEnv *env) {
    jclass class_double = createDoubleClass(env);
    jmethodID method_double = env->GetMethodID(class_double, "doubleValue", "()D");
    return method_double;
}

jmethodID JNIDoubleUtil::createDoubleDoubleValueMethod(JNIEnv *env, jclass class_double) {
    jmethodID method_double = env->GetMethodID(class_double, "doubleValue", "()D");
    return method_double;
}